package com.voice.core.connection.entity;

import com.voice.core.connection.Connection;
import com.voice.core.connection.callback.StreamListener;
import lombok.Data;


@Data
public class Stream {

    private int streamId;

    private StreamData streamData;

    private StreamListener streamListener;

    private Connection connection;

    public Stream(int streamId, StreamListener streamListener,Connection connection) {
        this.streamId = streamId;
        this.streamListener = streamListener;
        this.connection=connection;
    }

    public void close(){
        connection.removeStreamListener(streamId);
        connection=null;
        streamListener=null;
        streamData=null;
    }
}
